﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Iacym.Entities;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Iacym.Repository.Mapping
{
    public class LIBRO_IMAGENMap : EntityTypeConfiguration<LIBRO_IMAGEN>
    {
        public LIBRO_IMAGENMap()
        {
            // Primary Key
            this.HasKey(t => t.LibroId);

            // Properties
            this.Property(t => t.LibroId)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Imagen)
                .HasColumnType("image");

            // Table & Column Mappings
            this.ToTable("LIBRO_IMAGEN");
            this.Property(t => t.LibroId).HasColumnName("LibroId");
            this.Property(t => t.Imagen).HasColumnName("Imagen");
            this.Property(t => t.Hash).HasColumnName("Hash");

            // Relationships
            this.HasRequired(t => t.LIBRO)
                .WithOptional(t => t.LIBRO_IMAGEN);
        }
    }
}
